# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-typeguard
pkgver=3.0.2
_commit=db7771024eb2f6eba03c3954f8abe0f03bded3c2
pkgrel=2
pkgdesc="Run-time type checker for Python"
url="https://github.com/agronholm/typeguard"
license=('MIT')
arch=('any')
depends=('python-typing_extensions')
makedepends=('git' 'python-build' 'python-installer' 'python-setuptools-scm' 'python-wheel')
checkdepends=('mypy' 'python-pytest')
source=("git+https://github.com/agronholm/typeguard.git#commit=$_commit")
sha512sums=('SKIP')

build() {
  cd typeguard
  python -m build -nw
}

check() {
  cd typeguard
  # https://github.com/agronholm/typeguard/issues/176
  PYTHONPATH="$PWD/build/lib" MYPYPATH="$PWD/build/lib" pytest
}

package() {
  cd typeguard
  python -m installer -d "$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
